home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk61
/
diskfree
/
diskfree.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-19
|
1KB
|
43 lines
#include <dos.h> /* get DISKINFO structure */
#include <stdio.h> /* need for printf */
void main(argc,argv)
int argc;
char *argv[];
{
struct DISKINFO info; /* structure needed for getdfs found in <dos,h>*/
long size; /* needed to calculate free disk space */
int error; /* error = 0 if getdfs is successful */
if(argc != 2) /* make sure that a drive is specified */
{
printf("USAGE: "); /* print error message if no */
printf("DFREE [drive] \n"); /* or too many drives given */
exit(0); /* then exit program */
}
error = getdfs(argv[1],&info); /* call getdfs,error = 0 if */
/* successful */
if(error == 0) /* calculate disk free space */
{
size = (info.id_NumBlocks - info.id_NumBlocksUsed)
* info.id_BytesPerBlock;
printf("drive "); /* print result */
printf(argv[1]);
printf(" has ");
printf("%d",size);
printf(" bytes free \n");
}
else /* if specified disk isn't found */
{
printf(argv[1]);
printf(" not found \n");
}
}